package com.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.system.pojo.User;
import com.system.service.UserService;

@RestController
@RequestMapping("/user/")
@RefreshScope // 刷新配置
public class UserController {

	@Autowired
	private UserService userService;

	@Value("${test.name}")
	private String name;

	@GetMapping("{id}")
	public User getById(@PathVariable String id) {
//		try {
//			Thread.sleep(3000);
//		} catch (Exception e) {
//		}
		System.out.println("配置文件中的test.name为：" + name);
		return userService.getById(id);
	}
}
